/**
 * Created by zby on 2018/4/19.
 */

import java.lang.*;
import java.sql.*;
public class City {
    public static void main(String args[]) {
        Connection con=null;
        Statement sql;
        ResultSet rs;
        try{  Class.forName("com.mysql.jdbc.Driver");
        }
        catch(Exception e){}
        String uri = "jdbc:mysql://localhost:3306/world?useSSL=true";
        String user ="root";
        String password ="";
       //String c1="Population >1016521";
       // String sqlStr="select * from city where"+c1+"order by Population";
        try{
            con = DriverManager.getConnection(uri,user,password);
        }
        catch(SQLException e){ }
        try {
            sql=con.createStatement();
            rs=sql.executeQuery("select * from city");
            while(rs.next()) {
                int ID=rs.getInt(1);
                String name=rs.getString(2);
                String CountryCode=rs.getString(3);
                String District=rs.getString(4);
                int Population=rs.getInt(5);
                if(Population>=1016521){
                    System.out.printf("%d\t",ID);
                    System.out.printf("%s\t",name);
                    System.out.printf("%s\t",CountryCode);
                    System.out.printf("%s\t",District);
                    System.out.printf("%d\n",Population);
                }

            }
            con.close();
        }
        catch(SQLException e) {
            System.out.println(e);
        }
    }
}